n,b  = list(map(int,input().split()))
res = []
for i in range(n):
    a = int(input())
    res.append(a)
def quick_sort(res,start,end):
    if start<end:
        temp = res[start]
        left = start
        right = end
        while left <right:
            while res[right]<=temp and right>left:
                right-=1
            res[left] = res[right]
            while res[left]>temp and left<right:
                left+=1
            res[right] = res[left]
        res[left] = temp
        quick_sort(res,start,left-1)
        quick_sort(res,left+1,end)
quick_sort(res,0,n-1)
count = 0
temp1 = 0
for i in res:
    count+=1
    temp1+=i
    if temp1>=b:
        break
print(count)
    